package datestructuresjava.shuanglianbiao;

public class DoubleLinkedListDemo {
    public static void main(String[] args) {
        Node node1 = new Node(1, "A");
        Node node2 = new Node(2, "B");
        Node node3 = new Node(3, "C");
        Node node4 = new Node(4, "D");
        DoubleLinkedList doubleLinkedList = new DoubleLinkedList();
        // 在链表最后添加
		/*doubleLinkedList.addLast(node1);
		doubleLinkedList.addLast(node3);
		doubleLinkedList.addLast(node2);
		doubleLinkedList.addLast(node4);
		doubleLinkedList.list();*/
        // 按编号顺序添加
        doubleLinkedList.addByOrder(node3);
        doubleLinkedList.addByOrder(node2);
        doubleLinkedList.addByOrder(node4);
        doubleLinkedList.addByOrder(node1);
        doubleLinkedList.list();
        // 按编号修改
        doubleLinkedList.updateByOrder(new Node(2, "BBB"));
        doubleLinkedList.list();
        // 根据编号删除
        doubleLinkedList.deleteByOrder(3);
        doubleLinkedList.list();

    }


}
